import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: '/login',
    children: [
      {path: '/login', component: () => import('../views/home/LoginView.vue')},
      {path: '/reg', component: () => import('../views/home/RegView.vue')},
      {path: '/detail', component: () => import('../views/home/DetailView.vue')}
    ]
  },
  {
    path: '/admin',
    component: () => import('../views/Admin.vue'),
    redirect: '/admin/banner',
    children: [
      {path: 'user', component: () => import('../views/admin/UserView.vue')},
      {path: 'vehicle', component: () => import('../views/vehicle/vehicle-detailed.vue')},
      {path: 'combo', component: () => import('../views/vehicle/vehicle-combo.vue')},
      {path: 'checklist', component: () => import('../views/checklist/CheckList.vue')},
      {path: 'completed', component: () => import('../views/checklist/Completed.vue')},
      {path: 'customer', component: () => import('../views/customer/CustomerView.vue')},
      {
        path: '/station',
        name: 'station',
        redirect:'/stationInfo',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/station/StationView.vue'),
        children:[
          {path: '/pointMark', component: () => import('../views/station/PointMarkView.vue')},
          {path: '/stationInfo', component: () => import('../views/station/StationInfoView.vue')}
        ]
      },
    ]
  },
  // {
  //   path: '/station',
  //   name: 'station',
  //   redirect:'/stationInfo',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/station/StationView.vue'),
  //   children:[
  //     {path: '/pointMark', component: () => import('../views/station/PointMarkView.vue')},
  //     {path: '/stationInfo', component: () => import('../views/station/StationInfoView.vue')}
  //   ]
  // },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
